/**
 * 测试alarm函数
 * @author: sundx
 * @date: 2020-05-23 22:56:49
 * @Last Modified by: sundx
 * @Last Modified time: 2020-05-23 23:04:10
 */
#include <iostream>
#include <signal.h>
#include <sys/time.h>
#include <unistd.h>
void dealSig(int);
int main() {
  signal(SIGALRM, dealSig);
  while (1) {
    sleep(1);
    alarm(1);
  }
  return 0;
}
void dealSig(int sig) { std::cout << "got the sig: " << sig << std::endl; }
